<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CryptoAuthLib: i2c_bitbang_samd21.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CryptoAuthLib
   </div>
   <div id="projectbrief">Microchip CryptoAuthentication Library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('a00479.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">i2c_bitbang_samd21.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>definitions for bit-banged I2C  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="a00128_source.html">atca_status.h</a>&quot;</code><br />
<code>#include &lt;delay.h&gt;</code><br />
</div>
<p><a href="a00479_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a03679.html">I2CBuses</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:af89a7a4080a47aa10a5504291db285bf"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#af89a7a4080a47aa10a5504291db285bf">MAX_I2C_BUSES</a>&#160;&#160;&#160;18</td></tr>
<tr class="separator:af89a7a4080a47aa10a5504291db285bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7dccc9e88a018aa5e25ae1ffa955e04"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#ac7dccc9e88a018aa5e25ae1ffa955e04">I2C_ENABLE</a>()</td></tr>
<tr class="separator:ac7dccc9e88a018aa5e25ae1ffa955e04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35cdede808cc5e50ec96b86ec6d5186a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a35cdede808cc5e50ec96b86ec6d5186a">I2C_DISABLE</a>()</td></tr>
<tr class="separator:a35cdede808cc5e50ec96b86ec6d5186a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73ff0687b7b8e875a604eb441e30603b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a73ff0687b7b8e875a604eb441e30603b">I2C_CLOCK_LOW</a>()&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, false)</td></tr>
<tr class="separator:a73ff0687b7b8e875a604eb441e30603b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bafe0ef98693ff1f6e1a5239f397397"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a8bafe0ef98693ff1f6e1a5239f397397">I2C_CLOCK_HIGH</a>()&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, true)</td></tr>
<tr class="separator:a8bafe0ef98693ff1f6e1a5239f397397"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afce97c373c5ec7dff5b99e462bb8443d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#afce97c373c5ec7dff5b99e462bb8443d">I2C_DATA_LOW</a>()&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, false)</td></tr>
<tr class="separator:afce97c373c5ec7dff5b99e462bb8443d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97f972cfc30401e08fe25de26fcb3812"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a97f972cfc30401e08fe25de26fcb3812">I2C_DATA_HIGH</a>()&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, true)</td></tr>
<tr class="separator:a97f972cfc30401e08fe25de26fcb3812"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a67750a8227bb7dffd95a6bb04821194f"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a67750a8227bb7dffd95a6bb04821194f">I2C_DATA_IN</a>()&#160;&#160;&#160;port_pin_get_input_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>)</td></tr>
<tr class="separator:a67750a8227bb7dffd95a6bb04821194f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a704e88e63280d2b338c6d5aaa287ded6"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a704e88e63280d2b338c6d5aaa287ded6">I2C_SET_OUTPUT</a>()</td></tr>
<tr class="separator:a704e88e63280d2b338c6d5aaa287ded6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a560b261db9a1d59e1cd72a73da03d06c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a560b261db9a1d59e1cd72a73da03d06c">I2C_SET_OUTPUT_HIGH</a>()&#160;&#160;&#160;{ <a class="el" href="a00479.html#a704e88e63280d2b338c6d5aaa287ded6">I2C_SET_OUTPUT</a>(); <a class="el" href="a00479.html#a97f972cfc30401e08fe25de26fcb3812">I2C_DATA_HIGH</a>(); }</td></tr>
<tr class="separator:a560b261db9a1d59e1cd72a73da03d06c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9b2c622317087560cb142947b325cbe9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a9b2c622317087560cb142947b325cbe9">I2C_SET_OUTPUT_LOW</a>()&#160;&#160;&#160;{ <a class="el" href="a00479.html#a704e88e63280d2b338c6d5aaa287ded6">I2C_SET_OUTPUT</a>(); <a class="el" href="a00479.html#afce97c373c5ec7dff5b99e462bb8443d">I2C_DATA_LOW</a>(); }</td></tr>
<tr class="separator:a9b2c622317087560cb142947b325cbe9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3f1efda7918aca40566d1323f8feb7d9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a3f1efda7918aca40566d1323f8feb7d9">I2C_SET_INPUT</a>()</td></tr>
<tr class="separator:a3f1efda7918aca40566d1323f8feb7d9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a07adac5c5eb0d63bed4b79a50bcb676b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a07adac5c5eb0d63bed4b79a50bcb676b">DISABLE_INTERRUPT</a>()&#160;&#160;&#160;cpu_irq_disable()</td></tr>
<tr class="separator:a07adac5c5eb0d63bed4b79a50bcb676b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6b267a18dae3dc4d7a2a0b8fdb38e701"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a6b267a18dae3dc4d7a2a0b8fdb38e701">ENABLE_INTERRUPT</a>()&#160;&#160;&#160;cpu_irq_enable()</td></tr>
<tr class="separator:a6b267a18dae3dc4d7a2a0b8fdb38e701"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f8ab9b2d5d876f1541fa32b1e22e4a9"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a5f8ab9b2d5d876f1541fa32b1e22e4a9">I2C_CLOCK_DELAY_WRITE_LOW</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="separator:a5f8ab9b2d5d876f1541fa32b1e22e4a9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abeb77b3a0a6fe395e8b7ecf498850cd7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#abeb77b3a0a6fe395e8b7ecf498850cd7">I2C_CLOCK_DELAY_WRITE_HIGH</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="separator:abeb77b3a0a6fe395e8b7ecf498850cd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a06202abc9352b61a9b332d28530c1e8a"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a06202abc9352b61a9b332d28530c1e8a">I2C_CLOCK_DELAY_READ_LOW</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="separator:a06202abc9352b61a9b332d28530c1e8a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacc56272d59b9d3ebd0e6837727b81d8"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#aacc56272d59b9d3ebd0e6837727b81d8">I2C_CLOCK_DELAY_READ_HIGH</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="separator:aacc56272d59b9d3ebd0e6837727b81d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a260f2a8cd964aa89a1d6946b2a99f0a4"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a260f2a8cd964aa89a1d6946b2a99f0a4">I2C_CLOCK_DELAY_SEND_ACK</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="separator:a260f2a8cd964aa89a1d6946b2a99f0a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afcbe5a222e1facc4e8023c326ca8430c"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#afcbe5a222e1facc4e8023c326ca8430c">I2C_HOLD_DELAY</a>()&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td></tr>
<tr class="memdesc:afcbe5a222e1facc4e8023c326ca8430c"><td class="mdescLeft">&#160;</td><td class="mdescRight">This delay is inserted to make the Start and Stop hold time at least 250 ns.  <a href="#afcbe5a222e1facc4e8023c326ca8430c">More...</a><br /></td></tr>
<tr class="separator:afcbe5a222e1facc4e8023c326ca8430c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f8a83ae9459703637408a0a194445ac"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a4f8a83ae9459703637408a0a194445ac">I2C_ACK_TIMEOUT</a>&#160;&#160;&#160;(4)</td></tr>
<tr class="memdesc:a4f8a83ae9459703637408a0a194445ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">loop count when waiting for an acknowledgment  <a href="#a4f8a83ae9459703637408a0a194445ac">More...</a><br /></td></tr>
<tr class="separator:a4f8a83ae9459703637408a0a194445ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aecf10ae5c65e5e8d20f29acc2fcd5d7d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#aecf10ae5c65e5e8d20f29acc2fcd5d7d">i2c_set_pin</a> (uint8_t sda, uint8_t scl)</td></tr>
<tr class="memdesc:aecf10ae5c65e5e8d20f29acc2fcd5d7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set I2C data and clock pin. Other functions will use these pins.  <a href="#aecf10ae5c65e5e8d20f29acc2fcd5d7d">More...</a><br /></td></tr>
<tr class="separator:aecf10ae5c65e5e8d20f29acc2fcd5d7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a43b4ceef3780597f5f667ff9cfd0f191"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a43b4ceef3780597f5f667ff9cfd0f191">i2c_discover_buses</a> (int i2c_bitbang_buses[], int max_buses)</td></tr>
<tr class="memdesc:a43b4ceef3780597f5f667ff9cfd0f191"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assigns the logical bus number for discovering the devices.  <a href="#a43b4ceef3780597f5f667ff9cfd0f191">More...</a><br /></td></tr>
<tr class="separator:a43b4ceef3780597f5f667ff9cfd0f191"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5a1923e2271df541e858cb4e05d7b895"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a5a1923e2271df541e858cb4e05d7b895">i2c_enable</a> (void)</td></tr>
<tr class="memdesc:a5a1923e2271df541e858cb4e05d7b895"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure GPIO pins for I2C clock and data as output.  <a href="#a5a1923e2271df541e858cb4e05d7b895">More...</a><br /></td></tr>
<tr class="separator:a5a1923e2271df541e858cb4e05d7b895"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abe70f8fe4c72329b89ec526c749f50d7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#abe70f8fe4c72329b89ec526c749f50d7">i2c_disable</a> (void)</td></tr>
<tr class="memdesc:abe70f8fe4c72329b89ec526c749f50d7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure GPIO pins for I2C clock and data as input.  <a href="#abe70f8fe4c72329b89ec526c749f50d7">More...</a><br /></td></tr>
<tr class="separator:abe70f8fe4c72329b89ec526c749f50d7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a128fce372792e241c66c533edec30c1b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a128fce372792e241c66c533edec30c1b">i2c_send_start</a> (void)</td></tr>
<tr class="memdesc:a128fce372792e241c66c533edec30c1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a START condition.  <a href="#a128fce372792e241c66c533edec30c1b">More...</a><br /></td></tr>
<tr class="separator:a128fce372792e241c66c533edec30c1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a223e077dcbdfaf7944f76664c81c4c3b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a223e077dcbdfaf7944f76664c81c4c3b">i2c_send_ack</a> (uint8_t ack)</td></tr>
<tr class="memdesc:a223e077dcbdfaf7944f76664c81c4c3b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send an ACK or NACK (after receive).  <a href="#a223e077dcbdfaf7944f76664c81c4c3b">More...</a><br /></td></tr>
<tr class="separator:a223e077dcbdfaf7944f76664c81c4c3b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a28d871f938b84b40a153a806c55d6aef"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a28d871f938b84b40a153a806c55d6aef">i2c_send_stop</a> (void)</td></tr>
<tr class="memdesc:a28d871f938b84b40a153a806c55d6aef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a STOP condition.  <a href="#a28d871f938b84b40a153a806c55d6aef">More...</a><br /></td></tr>
<tr class="separator:a28d871f938b84b40a153a806c55d6aef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a20d903bd4606203e120babaf3fe4d926"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a20d903bd4606203e120babaf3fe4d926">i2c_send_wake_token</a> (void)</td></tr>
<tr class="memdesc:a20d903bd4606203e120babaf3fe4d926"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a Wake Token.  <a href="#a20d903bd4606203e120babaf3fe4d926">More...</a><br /></td></tr>
<tr class="separator:a20d903bd4606203e120babaf3fe4d926"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a04db7e3e2316cb43e97250a12c4eb81b"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00128.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a04db7e3e2316cb43e97250a12c4eb81b">i2c_send_byte</a> (uint8_t i2c_byte)</td></tr>
<tr class="memdesc:a04db7e3e2316cb43e97250a12c4eb81b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send one byte.  <a href="#a04db7e3e2316cb43e97250a12c4eb81b">More...</a><br /></td></tr>
<tr class="separator:a04db7e3e2316cb43e97250a12c4eb81b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a281f835e0c21015a8ab672b08940b730"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00128.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a281f835e0c21015a8ab672b08940b730">i2c_send_bytes</a> (uint8_t count, uint8_t *data)</td></tr>
<tr class="memdesc:a281f835e0c21015a8ab672b08940b730"><td class="mdescLeft">&#160;</td><td class="mdescRight">Send a number of bytes.  <a href="#a281f835e0c21015a8ab672b08940b730">More...</a><br /></td></tr>
<tr class="separator:a281f835e0c21015a8ab672b08940b730"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2f6cabfafc11c56ea8335f54fac20343"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a2f6cabfafc11c56ea8335f54fac20343">i2c_receive_one_byte</a> (uint8_t ack)</td></tr>
<tr class="memdesc:a2f6cabfafc11c56ea8335f54fac20343"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive one byte (MSB first).  <a href="#a2f6cabfafc11c56ea8335f54fac20343">More...</a><br /></td></tr>
<tr class="separator:a2f6cabfafc11c56ea8335f54fac20343"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2a3abf2b54b2161feeaf57fdc834586e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a2a3abf2b54b2161feeaf57fdc834586e">i2c_receive_byte</a> (uint8_t *data)</td></tr>
<tr class="memdesc:a2a3abf2b54b2161feeaf57fdc834586e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive one byte and send ACK.  <a href="#a2a3abf2b54b2161feeaf57fdc834586e">More...</a><br /></td></tr>
<tr class="separator:a2a3abf2b54b2161feeaf57fdc834586e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a690ed5c65fe26bbbdf166bbaaf177fc9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a690ed5c65fe26bbbdf166bbaaf177fc9">i2c_receive_bytes</a> (uint8_t count, uint8_t *data)</td></tr>
<tr class="memdesc:a690ed5c65fe26bbbdf166bbaaf177fc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Receive a number of bytes.  <a href="#a690ed5c65fe26bbbdf166bbaaf177fc9">More...</a><br /></td></tr>
<tr class="separator:a690ed5c65fe26bbbdf166bbaaf177fc9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:ad2e9f2387bb528f37bceb48cd88af3d0"><td class="memItemLeft" align="right" valign="top"><a class="el" href="a03679.html">I2CBuses</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#ad2e9f2387bb528f37bceb48cd88af3d0">i2c_buses_default</a></td></tr>
<tr class="separator:ad2e9f2387bb528f37bceb48cd88af3d0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afd6d53ef6b697533839248b40bc97861"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a></td></tr>
<tr class="separator:afd6d53ef6b697533839248b40bc97861"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a30ad301ad2a35d50b2e4284a58b82b67"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a></td></tr>
<tr class="separator:a30ad301ad2a35d50b2e4284a58b82b67"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>definitions for bit-banged I2C </p>
<dl class="section copyright"><dt>Copyright</dt><dd>(c) 2015-2018 Microchip Technology Inc. and its subsidiaries. </dd></dl>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a07adac5c5eb0d63bed4b79a50bcb676b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a07adac5c5eb0d63bed4b79a50bcb676b">&#9670;&nbsp;</a></span>DISABLE_INTERRUPT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define DISABLE_INTERRUPT</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;cpu_irq_disable()</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a6b267a18dae3dc4d7a2a0b8fdb38e701"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6b267a18dae3dc4d7a2a0b8fdb38e701">&#9670;&nbsp;</a></span>ENABLE_INTERRUPT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define ENABLE_INTERRUPT</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;cpu_irq_enable()</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a4f8a83ae9459703637408a0a194445ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4f8a83ae9459703637408a0a194445ac">&#9670;&nbsp;</a></span>I2C_ACK_TIMEOUT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_ACK_TIMEOUT&#160;&#160;&#160;(4)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>loop count when waiting for an acknowledgment </p>

</div>
</div>
<a id="aacc56272d59b9d3ebd0e6837727b81d8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aacc56272d59b9d3ebd0e6837727b81d8">&#9670;&nbsp;</a></span>I2C_CLOCK_DELAY_READ_HIGH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_DELAY_READ_HIGH</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a06202abc9352b61a9b332d28530c1e8a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a06202abc9352b61a9b332d28530c1e8a">&#9670;&nbsp;</a></span>I2C_CLOCK_DELAY_READ_LOW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_DELAY_READ_LOW</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a260f2a8cd964aa89a1d6946b2a99f0a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a260f2a8cd964aa89a1d6946b2a99f0a4">&#9670;&nbsp;</a></span>I2C_CLOCK_DELAY_SEND_ACK</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_DELAY_SEND_ACK</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="abeb77b3a0a6fe395e8b7ecf498850cd7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abeb77b3a0a6fe395e8b7ecf498850cd7">&#9670;&nbsp;</a></span>I2C_CLOCK_DELAY_WRITE_HIGH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_DELAY_WRITE_HIGH</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a5f8ab9b2d5d876f1541fa32b1e22e4a9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f8ab9b2d5d876f1541fa32b1e22e4a9">&#9670;&nbsp;</a></span>I2C_CLOCK_DELAY_WRITE_LOW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_DELAY_WRITE_LOW</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a8bafe0ef98693ff1f6e1a5239f397397"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8bafe0ef98693ff1f6e1a5239f397397">&#9670;&nbsp;</a></span>I2C_CLOCK_HIGH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_HIGH</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, true)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a73ff0687b7b8e875a604eb441e30603b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a73ff0687b7b8e875a604eb441e30603b">&#9670;&nbsp;</a></span>I2C_CLOCK_LOW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_CLOCK_LOW</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, false)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a97f972cfc30401e08fe25de26fcb3812"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97f972cfc30401e08fe25de26fcb3812">&#9670;&nbsp;</a></span>I2C_DATA_HIGH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_DATA_HIGH</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, true)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a67750a8227bb7dffd95a6bb04821194f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a67750a8227bb7dffd95a6bb04821194f">&#9670;&nbsp;</a></span>I2C_DATA_IN</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_DATA_IN</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;port_pin_get_input_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="afce97c373c5ec7dff5b99e462bb8443d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afce97c373c5ec7dff5b99e462bb8443d">&#9670;&nbsp;</a></span>I2C_DATA_LOW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_DATA_LOW</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;port_pin_set_output_level(<a class="el" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, false)</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a35cdede808cc5e50ec96b86ec6d5186a"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a35cdede808cc5e50ec96b86ec6d5186a">&#9670;&nbsp;</a></span>I2C_DISABLE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_DISABLE</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{  <span class="keyword">struct </span>port_config <a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>; \</div><div class="line">                                    port_get_config_defaults(&amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                    pin_conf.direction  = PORT_PIN_DIR_INPUT; \</div><div class="line">                                    pin_conf.input_pull = PORT_PIN_PULL_UP; \</div><div class="line">                                    port_pin_set_config(<a class="code" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                    port_pin_set_config(<a class="code" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); }</div><div class="ttc" id="a03537_html_gaab85cb460831e8b7e4d3a5315b31c596"><div class="ttname"><a href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a></div><div class="ttdeci">struct port_config pin_conf</div><div class="ttdef"><b>Definition:</b> swi_uart_samd21_asf.c:44</div></div>
<div class="ttc" id="a00479_html_afd6d53ef6b697533839248b40bc97861"><div class="ttname"><a href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a></div><div class="ttdeci">uint8_t pin_sda</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
<div class="ttc" id="a00479_html_a30ad301ad2a35d50b2e4284a58b82b67"><div class="ttname"><a href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a></div><div class="ttdeci">uint8_t pin_scl</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ac7dccc9e88a018aa5e25ae1ffa955e04"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7dccc9e88a018aa5e25ae1ffa955e04">&#9670;&nbsp;</a></span>I2C_ENABLE</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_ENABLE</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{  <span class="keyword">struct </span>port_config <a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>; \</div><div class="line">                                   port_get_config_defaults(&amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                   pin_conf.direction  = PORT_PIN_DIR_OUTPUT_WTH_READBACK; \</div><div class="line">                                   port_pin_set_config(<a class="code" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                   pin_conf.direction  = PORT_PIN_DIR_OUTPUT; \</div><div class="line">                                   port_pin_set_config(<a class="code" href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); }</div><div class="ttc" id="a03537_html_gaab85cb460831e8b7e4d3a5315b31c596"><div class="ttname"><a href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a></div><div class="ttdeci">struct port_config pin_conf</div><div class="ttdef"><b>Definition:</b> swi_uart_samd21_asf.c:44</div></div>
<div class="ttc" id="a00479_html_afd6d53ef6b697533839248b40bc97861"><div class="ttname"><a href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a></div><div class="ttdeci">uint8_t pin_sda</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
<div class="ttc" id="a00479_html_a30ad301ad2a35d50b2e4284a58b82b67"><div class="ttname"><a href="a00479.html#a30ad301ad2a35d50b2e4284a58b82b67">pin_scl</a></div><div class="ttdeci">uint8_t pin_scl</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="afcbe5a222e1facc4e8023c326ca8430c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afcbe5a222e1facc4e8023c326ca8430c">&#9670;&nbsp;</a></span>I2C_HOLD_DELAY</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_HOLD_DELAY</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;<a class="el" href="a03537.html#gafd0e52ccc611a61fcd1b0b6cd1a19efd">delay_us</a>(1)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This delay is inserted to make the Start and Stop hold time at least 250 ns. </p>

</div>
</div>
<a id="a3f1efda7918aca40566d1323f8feb7d9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3f1efda7918aca40566d1323f8feb7d9">&#9670;&nbsp;</a></span>I2C_SET_INPUT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_SET_INPUT</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{  <span class="keyword">struct </span>port_config <a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>; \</div><div class="line">                                    port_get_config_defaults(&amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                    pin_conf.direction  = PORT_PIN_DIR_INPUT; \</div><div class="line">                                    port_pin_set_config(<a class="code" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); }</div><div class="ttc" id="a03537_html_gaab85cb460831e8b7e4d3a5315b31c596"><div class="ttname"><a href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a></div><div class="ttdeci">struct port_config pin_conf</div><div class="ttdef"><b>Definition:</b> swi_uart_samd21_asf.c:44</div></div>
<div class="ttc" id="a00479_html_afd6d53ef6b697533839248b40bc97861"><div class="ttname"><a href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a></div><div class="ttdeci">uint8_t pin_sda</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a704e88e63280d2b338c6d5aaa287ded6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a704e88e63280d2b338c6d5aaa287ded6">&#9670;&nbsp;</a></span>I2C_SET_OUTPUT</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_SET_OUTPUT</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<b>Value:</b><div class="fragment"><div class="line">{  <span class="keyword">struct </span>port_config <a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>; \</div><div class="line">                                    port_get_config_defaults(&amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); \</div><div class="line">                                    pin_conf.direction  = PORT_PIN_DIR_OUTPUT_WTH_READBACK; \</div><div class="line">                                    port_pin_set_config(<a class="code" href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a>, &amp;<a class="code" href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a>); }</div><div class="ttc" id="a03537_html_gaab85cb460831e8b7e4d3a5315b31c596"><div class="ttname"><a href="a03537.html#gaab85cb460831e8b7e4d3a5315b31c596">pin_conf</a></div><div class="ttdeci">struct port_config pin_conf</div><div class="ttdef"><b>Definition:</b> swi_uart_samd21_asf.c:44</div></div>
<div class="ttc" id="a00479_html_afd6d53ef6b697533839248b40bc97861"><div class="ttname"><a href="a00479.html#afd6d53ef6b697533839248b40bc97861">pin_sda</a></div><div class="ttdeci">uint8_t pin_sda</div><div class="ttdef"><b>Definition:</b> i2c_bitbang_samd21.c:40</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a560b261db9a1d59e1cd72a73da03d06c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a560b261db9a1d59e1cd72a73da03d06c">&#9670;&nbsp;</a></span>I2C_SET_OUTPUT_HIGH</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_SET_OUTPUT_HIGH</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;{ <a class="el" href="a00479.html#a704e88e63280d2b338c6d5aaa287ded6">I2C_SET_OUTPUT</a>(); <a class="el" href="a00479.html#a97f972cfc30401e08fe25de26fcb3812">I2C_DATA_HIGH</a>(); }</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a9b2c622317087560cb142947b325cbe9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9b2c622317087560cb142947b325cbe9">&#9670;&nbsp;</a></span>I2C_SET_OUTPUT_LOW</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define I2C_SET_OUTPUT_LOW</td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td>&#160;&#160;&#160;{ <a class="el" href="a00479.html#a704e88e63280d2b338c6d5aaa287ded6">I2C_SET_OUTPUT</a>(); <a class="el" href="a00479.html#afce97c373c5ec7dff5b99e462bb8443d">I2C_DATA_LOW</a>(); }</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="af89a7a4080a47aa10a5504291db285bf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af89a7a4080a47aa10a5504291db285bf">&#9670;&nbsp;</a></span>MAX_I2C_BUSES</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define MAX_I2C_BUSES&#160;&#160;&#160;18</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="abe70f8fe4c72329b89ec526c749f50d7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abe70f8fe4c72329b89ec526c749f50d7">&#9670;&nbsp;</a></span>i2c_disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure GPIO pins for I2C clock and data as input. </p>

</div>
</div>
<a id="a43b4ceef3780597f5f667ff9cfd0f191"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a43b4ceef3780597f5f667ff9cfd0f191">&#9670;&nbsp;</a></span>i2c_discover_buses()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_discover_buses </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>i2c_bitbang_buses</em>[], </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_buses</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Assigns the logical bus number for discovering the devices. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">i2c_bitbang_buses</td><td>The logical bus numbers are assigned to the variables. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">max_buses</td><td>Maximum number of bus used for discovering. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a5a1923e2271df541e858cb4e05d7b895"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5a1923e2271df541e858cb4e05d7b895">&#9670;&nbsp;</a></span>i2c_enable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_enable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configure GPIO pins for I2C clock and data as output. </p>

</div>
</div>
<a id="a2a3abf2b54b2161feeaf57fdc834586e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2a3abf2b54b2161feeaf57fdc834586e">&#9670;&nbsp;</a></span>i2c_receive_byte()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_receive_byte </td>
          <td>(</td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive one byte and send ACK. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>pointer to received byte </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a690ed5c65fe26bbbdf166bbaaf177fc9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a690ed5c65fe26bbbdf166bbaaf177fc9">&#9670;&nbsp;</a></span>i2c_receive_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_receive_bytes </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive a number of bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[out]</td><td class="paramname">data</td><td>pointer to receive buffer </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">count</td><td>number of bytes to receive </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a2f6cabfafc11c56ea8335f54fac20343"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2f6cabfafc11c56ea8335f54fac20343">&#9670;&nbsp;</a></span>i2c_receive_one_byte()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t i2c_receive_one_byte </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>ack</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Receive one byte (MSB first). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ack</td><td>0:NACK, else:ACK</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Number of bytes received </dd></dl>
<p>We don't need to delay after the last bit because it takes time to switch the pin to output for acknowledging. </p>

</div>
</div>
<a id="a223e077dcbdfaf7944f76664c81c4c3b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a223e077dcbdfaf7944f76664c81c4c3b">&#9670;&nbsp;</a></span>i2c_send_ack()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_send_ack </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>ack</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send an ACK or NACK (after receive). </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ack</td><td>0: NACK, else: ACK </td></tr>
  </table>
  </dd>
</dl>
<p>&lt; Low data line indicates an ACK.</p>
<p>&lt; High data line indicates a NACK.</p>
<p>Clock out acknowledgment. </p>

</div>
</div>
<a id="a04db7e3e2316cb43e97250a12c4eb81b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a04db7e3e2316cb43e97250a12c4eb81b">&#9670;&nbsp;</a></span>i2c_send_byte()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00128.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> i2c_send_byte </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>i2c_byte</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send one byte. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">i2c_byte</td><td>byte to write</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_STATUS </dd></dl>
<p>This avoids spikes but adds an if condition. We could parametrize the call to I2C_SET_OUTPUT and translate the msb to OUTSET or OUTCLR, but then the code would become target specific. <br />
<br />
<br />
<br />
<br />
<br />
 Send 8 bits of data.</p>
<p>Clock out the data bit.</p>
<p>Shifting while clock is high compensates for the time it takes to evaluate the bit while clock is low. That way, the low and high time of the clock pin is almost equal. <br />
<br />
<br />
 Clock in last data bit.</p>
<p>Set data line to be an input.</p>
<p>Wait for the ack. </p>

</div>
</div>
<a id="a281f835e0c21015a8ab672b08940b730"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a281f835e0c21015a8ab672b08940b730">&#9670;&nbsp;</a></span>i2c_send_bytes()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00128.html#a22bd6643f31f1d75dc3e7ea939f468cd">ATCA_STATUS</a> i2c_send_bytes </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>count</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t *&#160;</td>
          <td class="paramname"><em>data</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a number of bytes. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">count</td><td>number of bytes to send </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">data</td><td>pointer to buffer containing bytes to send</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>ATCA_STATUS </dd></dl>

</div>
</div>
<a id="a128fce372792e241c66c533edec30c1b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a128fce372792e241c66c533edec30c1b">&#9670;&nbsp;</a></span>i2c_send_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_send_start </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a START condition. </p>
<p>Set clock high in case we re-start. </p>

</div>
</div>
<a id="a28d871f938b84b40a153a806c55d6aef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a28d871f938b84b40a153a806c55d6aef">&#9670;&nbsp;</a></span>i2c_send_stop()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_send_stop </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a STOP condition. </p>

</div>
</div>
<a id="a20d903bd4606203e120babaf3fe4d926"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a20d903bd4606203e120babaf3fe4d926">&#9670;&nbsp;</a></span>i2c_send_wake_token()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_send_wake_token </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Send a Wake Token. </p>

</div>
</div>
<a id="aecf10ae5c65e5e8d20f29acc2fcd5d7d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aecf10ae5c65e5e8d20f29acc2fcd5d7d">&#9670;&nbsp;</a></span>i2c_set_pin()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void i2c_set_pin </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>sda</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>scl</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Set I2C data and clock pin. Other functions will use these pins. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">sda</td><td>definition of GPIO pin to be used as data pin </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">scl</td><td>definition of GPIO pin to be used as clock pin </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="ad2e9f2387bb528f37bceb48cd88af3d0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad2e9f2387bb528f37bceb48cd88af3d0">&#9670;&nbsp;</a></span>i2c_buses_default</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a03679.html">I2CBuses</a> i2c_buses_default</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="a30ad301ad2a35d50b2e4284a58b82b67"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a30ad301ad2a35d50b2e4284a58b82b67">&#9670;&nbsp;</a></span>pin_scl</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t pin_scl</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<a id="afd6d53ef6b697533839248b40bc97861"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afd6d53ef6b697533839248b40bc97861">&#9670;&nbsp;</a></span>pin_sda</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t pin_sda</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_97aefd0d527b934f1d99a682da8fe6a9.html">lib</a></li><li class="navelem"><a class="el" href="dir_e870e4dac26de7990352b1cb7547818f.html">hal</a></li><li class="navelem"><a class="el" href="a00479.html">i2c_bitbang_samd21.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
  </ul>
</div>
</body>
</html>
